// import Cookies from 'js-cookie'
import { encode, decode } from "./base64.js";

const TokenKey = "";
// Cookies.set(TokenKey, 'ssdbsjdsisgui')

// export function getToken() {
//   return Cookies.get(TokenKey)
// }

// export function setToken(token) {
//   return Cookies.set(TokenKey, token)
// }

// export function removeToken() {
//   return Cookies.remove(TokenKey)
// }

export function getToken() {
  return localStorage.getItem("token");
}

export function setToken(TokenKey) {
  return localStorage.setItem("token", TokenKey);
}

export function removeToken() {
  return localStorage.removeItem("token");
}
export function getLoginName() {
  return localStorage.getItem("loginName");
}
export function setLoginName(value) {
  return localStorage.setItem("loginName", value);
}
export function removeLoginName() {
  return localStorage.removeItem("loginName");
}
export function setResorceList(list) {
  let this_ = localStorage.setItem("ResorceList", encode(list));
  let changeLimit = new Event("changeLimit");
  changeLimit.key = "limit";
  changeLimit.newValue = list;
  window.dispatchEvent(changeLimit);
  return this_;
}
export function getResorceList() {
  return decode(localStorage.getItem("ResorceList"));
}
export function removeResorceList() {
  return localStorage.removeItem("ResorceList");
}
export function setMenus(list) {
  return localStorage.setItem("Menus", encode(list));
}
export function getMenus() {
  return decode(localStorage.getItem("Menus"));
}
export function removeMenus() {
  return localStorage.removeItem("Menus");
}
export function setLoginInfo(info) {
  return localStorage.setItem("loginInfo", info);
}
export function getLoginInfo() {
  return localStorage.getItem("loginInfo");
}
export function removeLoginInfo() {
  return localStorage.removeItem("loginInfo");
}

export function setColor(v) {
  return localStorage.setItem("theme", v);
}
export function getColor() {
  return localStorage.getItem("theme");
}
export function removeColor() {
  return localStorage.removeItem("theme");
}
